<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.ecside.org" prefix="ec"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>任务列表</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
</head>
<style>
.emailPreview{
	border: 1px solid #5894ca;
	width: 382px;
	background-color: white;
	position: absolute;
	left: 340px;
	top: 30px;
}
#select-dev-people{
	background-color: rgb(249, 249, 249);
    border: 1px solid #d9d9d9;
    border-color: #20548A;
    border-radius: 5px 5px 0 0;
    width: 15%;
    float: left;
    text-align: left;
    margin-top: 10px;
    height: 520px;
    overflow: auto;
}
ul{
    list-style: none;
    margin-left: -30px;
    margin-top: -10px;
}
#overall-box{
    width: 84%;
    float: right;
}
#list-content{
    
}
label:hover{
cursor:point
}
.queryTable {
 
}
.select-role{
	background: url(../aeaipm/images/decorator/bg2.gif) repeat-x;
	height: 28px;
    line-height: 28px;
    color: white;
    margin-top: 0px;
    text-align: left;
    overflow: hidden;
    font-size: 12px;
    border-radius: 5px 5px 0 0;
}
.heidden-div{
	display: none;
}
.show-div{
	width: 100% !important;
}
input[type="radio" i] {
       vertical-align:sub;
}
#test-title{
	color: rgb(255, 0, 68);
    position: absolute;
    float: right;
    margin-left: 80%;
}
</style>
<script>
function setDescribe(argm){
	$("#currentAction").val(argm);
	$('#emailPreview').show();
	$("#TDO_CONTENT").removeAttr("readonly style");
}
$(function (){ 
	$('#emailPreviewBanner').mousedown( 
		function (event) { 
			var isMove = true; 
			var abs_x = event.pageX - $('div.emailPreview').offset().left; 
			var abs_y = event.pageY - $('div.emailPreview').offset().top; 
			$(document).mousemove(function (event) { 
				if (isMove) { 
					var obj = $('div.emailPreview'); 
					obj.css({'left':event.pageX - abs_x, 'top':event.pageY - abs_y}); 
					} 
			} ).mouseup( 
				function () { 
					isMove = false; 
			} ); } ); } 
); 
function closeEmailPreview(){
	$('#emailPreview').hide();
	var argm=$('#currentAction').val()
	if(argm=='distribution'){
		$('#TPD_PROPERSON_ID').val($("#current_manager_id").val())
		$('#TPD_PROPERSON_NAME').val($("#current_manager_name").val()) 
		distribution();
	}
	if(argm=='notRecognized'){
		notRecognized();
	}
}
</script>
<body hidden>
<div id="test-title">测试方案：<%=pageBean.inputDate("PT_NAME")%></div>
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
  
	<div id="select-dev-people" <%if(pageBean.getBoolValue("isNotMaster")==true){%>class="heidden-div" <%};%> > 
				<h3 class="select-role">&nbsp;&nbsp;选择角色</h3>
				<%=pageBean.inputValue("userNameRadio")%>
	</div>

<div id="overall-box"  <%if(pageBean.getBoolValue("isNotMaster")==true){%> class="show-div" <%};%>  >
	<div id="__ToolBar__">
	
	
	<table class="toolTable" border="0" cellpadding="0" <%=pageBean.inputValue("buttonGroup1")%>   cellspacing="1">
	<tr>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="E" align="center" onclick="toReleaseDetail('insert')"><input value="&nbsp;" id="addDEfectBtn" title="新增" type="button" class="createImgBtn" />新增</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="A" align="center" onclick="toReleaseDetail('update')"><input value="&nbsp;" title="编辑" id="editImgBtn" type="button" class="editImgBtn" />编辑</td>
	   <!-- <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="C" align="center" onclick="toReleaseDetail('copy')"><input value="&nbsp;" title="复制" type="button" class="copyImgBtn" />复制</td> -->
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="D" align="center" onclick="toReleaseDetail('detail')"><input value="&nbsp;" title="查看" type="button" class="detailImgBtn" />查看</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="E" align="center" onclick="approval()"><input value="&nbsp;" title="认可" type="button" id="approvalImgBtn" class="submitImgBtn" />认可</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="F" align="center" onclick="setDescribe('notRecognized')"><input value="&nbsp;" title="不认可" type="button" id="notRecognImgBtn"  class="denyImgBtn" />不认可</td>  
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="G" align="center" onclick="release()"><input value="&nbsp;" title="发布" type="button"  id="releaseImgBtn" class="releaseImgBtn" />提交</td>
	</tr>
	</table>
	<table class="toolTable" border="0" cellpadding="0" <%=pageBean.inputValue("buttonGroup2")%>  cellspacing="1">
	<tr>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="H" align="center" onclick="toReleaseDetail('detail')"><input value="&nbsp;" title="查看" type="button" class="detailImgBtn" />查看</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="I" align="center" onclick="resolved()"><input value="&nbsp;" title="发布" type="button" id="resolvedImgBtn" class="solveImgBtn" />已解决</td>
	</tr>
	</table>
	<table class="toolTable" border="0" cellpadding="0" <%=pageBean.inputValue("buttonGroup3")%>  cellspacing="1">
	<tr>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="J" align="center" onclick="toReleaseDetail('detail')"><input value="&nbsp;" title="查看" type="button" class="detailImgBtn" />查看</td>
	   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="L" align="center" onclick="toOpearLogDetail();"><input value="&nbsp;" title="操作日志" type="button" class="operationLog" />操作日志</td>
	</tr>
	</table>
	</div>
	<div id="__ParamBar__">
	<table class="queryTable">
		<tr><td>
	&nbsp;所属功能<input id="pfNames" readonly="readonly" label="所属功能" name="pfNames" type="text" value="<%=pageBean.inputValue("pfNames")%>" size="40" class="text" />
	<input id="pfIds" label="所属功能" name="pfIds" type="hidden" value="<%=pageBean.inputValue("pfIds")%>" size="40" class="text" />
	<img id="grpIdSelectImage" src="images/sta.gif" width="16" height="16" onclick="openTreeFunction()"/>
	&nbsp;<a onclick="clearPfids()">清空</a>
	</td></tr>
	
	<%if(!"hidden".equals(pageBean.inputValue("buttonGroup1"))){ %><tr ><td colspan="2">
	&nbsp;处理人员<input id="properson" label="处理人" name="properson" type="text" value="<%=pageBean.inputValue("properson")%>" size="7" class="text" />
	
	&nbsp;缺陷名称<input id="tpdName" label="缺陷名称" name="tpdName" type="text" value="<%=pageBean.inputValue("tpdName")%>" size="12" class="text" />
	 
	&nbsp;优先级<select id="tpdPriority" label="优先级" name="tpdPriority" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdPriority")%></select>
	</td></tr><%}%>
	<%if(!"hidden".equals(pageBean.inputValue("buttonGroup2"))){%><tr><td colspan="2">
	
	&nbsp;测试人员<input id="testPerson" label="测试人员" name="testPerson" type="text" value="<%=pageBean.inputValue("testPerson")%>" size="7" class="text" />
	
	&nbsp;缺陷名称<input id="tpdName" label="缺陷名称" name="tpdName" type="text" value="<%=pageBean.inputValue("tpdName")%>" size="12" class="text" />
	 
	&nbsp;优先级<select id="tpdPriority" label="优先级" name="tpdPriority" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdPriority")%></select>
	</td></tr><%}%>
	<%if(!"hidden".equals(pageBean.inputValue("buttonGroup3"))){%><tr><td colspan="2">
	&nbsp;处理人员<input id="properson" label="处理人" name="properson" type="text" value="<%=pageBean.inputValue("properson")%>" size="7" class="text" />
	
	&nbsp;测试人员<input id="testPerson" label="测试人员" name="testPerson" type="text" value="<%=pageBean.inputValue("testPerson")%>" size="7" class="text" />
	
	&nbsp;缺陷名称<input id="tpdName" label="缺陷名称" name="tpdName" type="text" value="<%=pageBean.inputValue("tpdName")%>" size="12" class="text" />
	 
	&nbsp;优先级<select id="tpdPriority" label="优先级" name="tpdPriority" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdPriority")%></select>
	</td></tr><%}%>
	
	<tr><td>
	&nbsp;发布时间<input id="releaseTimeStart" label="发布时间" name="releaseTimeStart" type="text" value="<%=pageBean.inputDate("releaseTimeStart")%>" size="7" class="text" /><img id="releaseTimeStartPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
	-<input id="releaseTimeEnd" label="发布时间" name="releaseTimeEnd" type="text" value="<%=pageBean.inputDate("releaseTimeEnd")%>" size="7" class="text" /><img id="releaseTimeEndPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
	
	&nbsp;处理时间<input id="processTimeStart" label="处理时间" name="processTimeStart" type="text" value="<%=pageBean.inputDate("processTimeStart")%>" size="7" class="text" /><img id="processTimeStartPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
	-<input id="processTimeEnd" label="处理时间" name="processTimeEnd" type="text" value="<%=pageBean.inputDate("processTimeEnd")%>" size="7" class="text" /><img id="processTimeEndPicker" src="images/calendar.gif" width="16" height="16" alt="日期/时间选择框" />
	
	&nbsp;缺陷类型<select id="tpdType" label="缺陷类型" name="tpdType" class="select" onchange="doQuery()"><%=pageBean.selectValue("tpdType")%></select>
	</td>
	</tr>
	<tr><td colspan="2" >
			&nbsp;<label><input type="checkbox" name="pdState" id="btnCheckAllpdState">全选</label>
			<%=pageBean.inputValue("tpdStateCheckBox")%>
			&nbsp;<input type="button" name="button" id="button" value="查询" class="formbutton" onclick="doQuery()" />
	</td></tr>
	</table>
	</div>

	<div id="list-content">
		<ec:table 
		form="form1"
		var="row"
		items="pageBean.rsList" csvFileName="任务列表.csv"
		retrieveRowsCallback="process" xlsFileName="任务列表.xls"
		useAjax="true" sortable="true"
		doPreload="false" toolbarContent="navigation|pagejump |pagesize |export|extend|status"
		width="100%" rowsDisplayed="15"
		listWidth="100%" 
		height="370px"
		>
		<ec:row styleClass="odd" ondblclick="toReleaseDetail('detail')" oncontextmenu="selectRow(this,{TPD_ID:'${row.TPD_ID}'});refreshConextmenu()" onclick="selectRow(this,{TPD_ID:'${row.TPD_ID}'});changeButtonState('${row.TPD_STATE}');">
			<ec:column width="50" style="text-align:center" property="_0" title="序号" value="${GLOBALROWCOUNT}" />
			<ec:column width="80" property="PF_NAME" title="所属功能"   />
			<ec:column width="80" property="TPD_NAME" title="缺陷名称"   />
			<ec:column width="100" property="TPD_TESTPERSON_NAME" title="测试人员"   />
			<ec:column width="100" property="TPD_RELEASE_TIME" title="提交时间" cell="date" format="yyyy-MM-dd HH" />
			<ec:column width="100" property="TPD_PROPERSON_NAME" title="处理人员"   />
			<ec:column width="100" property="TPD_PROCESS_TIME" title="处理时间" cell="date" format="yyyy-MM-dd HH:mm" />
			<ec:column width="100" property="TPD_STATE" title="当前状态"   mappingItem="TPD_STATE"/>
			<ec:column width="100" property="TPD_TYPE" title="缺陷类型"   mappingItem="TPD_TYPE"/>
			<ec:column width="100" property="TPD_PRIORITY" title="优先级"   mappingItem="TPD_PRIORITY"/>
		</ec:row>
		</ec:table>
	</div>
</div>
<div id="test-show"></div>
<div  id="emailPreview" class="emailPreview" hidden >
   <table id="emailPreviewBanner" width="100%"  border="0" style="border-collapse: collapse;">
  <tr>
    <td height="23" width="50%" style="background-image:url(images/box_header.png); background-repeat:no-repeat;padding-top:0px;padding-left:30px;font-size:14px;font-weight:bold;color:#FFF;">不认可理由</td>
    <td height="23" width="50%" align="right" style="background-color: #f3f3f3;text-align: right;"><span style="width:20px;height:20px;vertical-align: middle;margin:0px;padding:3px 3px 0px 3px;text-align:center;display:inline-block;" onmousemove="PopupBox.onMover(this)" onmouseout="PopupBox.onMout(this)"><img id="managerBoxImgBtn" onclick="javascript:$('#TDO_CONTENT').val('');$('#emailPreview').hide();$('#selectManager').hide();" src="images/close.gif" width="15" height="15" style="margin:0px;cursor:pointer" alt="关闭窗口" title="关闭窗口"></span></td>
  </tr>
</table>
<table>
<tr>
  <td >
  <textarea  id="TDO_CONTENT"  label="缺陷描述" name="TDO_CONTENT" cols="50" rows="4" class="textarea" canedit="true" ></textarea>
    </td>
</tr>
</table>
<p>
 	&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="button" name="button" id="button" value="确认" class="formbutton" onclick="closeEmailPreview();"> &nbsp;&nbsp;&nbsp;&nbsp;
	<input type="button" name="button" id="button" value="取消" class="formbutton" onclick="javascript:$('#TDO_CONTENT').val('');$('#emailPreview').hide();$('#selectManager').hide();"> 
</p>
   </div>
<input type="hidden" name="TPD_ID" id="TPD_ID" value="" />
<input type="hidden" name="currentAction" id="currentAction" value=""/>
<input type="hidden" name="fnName" id="fnName" value="<%=pageBean.inputValue("fnName")%>" />
<input type="hidden" name="userPost" id="userPost" value="<%=pageBean.inputValue("userPost")%>" />
<input type="hidden" name="actionType" id="actionType" />
<script language="JavaScript">
setRsIdTag('TPD_ID');
var ectableMenu = new EctableMenu('contextMenu','ec_table');
 
/* initCalendar('TPD_PROCESS_TIME','%Y-%m-%d %H:%M','TPD_PROCESS_TIMEPicker');
datetimeValidators[0].set("yyyy-MM-dd HH:mm").add("TPD_PROCESS_TIME"); */

initCalendar('releaseTimeStart','%Y-%m-%d','releaseTimeStartPicker');
initCalendar('releaseTimeEnd','%Y-%m-%d','releaseTimeEndPicker');
initCalendar('processTimeStart','%Y-%m-%d','processTimeStartPicker');
initCalendar('processTimeEnd','%Y-%m-%d','processTimeEndPicker');
var ReleasedetailBox;
function toReleaseDetail(operaType){ 
	var tpdId=$("#TPD_ID").val();
	if(("detail"==operaType||"copy"==operaType||"update"==operaType)&&!$("#TPD_ID").val()){
		showMessage("请选中一条记录！");
		return;
	}
	if(ResolveddetailBox||OpearLogDetailBox){
		PopupBox.closeCurrent();
	}
	if (!ReleasedetailBox){
		ReleasedetailBox = new PopupBox('ReleasedetailBox','缺陷发布',{size:'big',width:'760px',height:'420px',top:'30px'});
	}
	var url = "index?TestProjectDefectReleaseDetail&TPD_ID="+tpdId+"&operaType="+operaType+"&fnName="+$('#fnName').val()+"&userId="+$("input[name='userName']:checked").val();
	ReleasedetailBox.sendRequest(url); 
}
var ResolveddetailBox;
function toResolvedDetail(carId){
	if(ReleasedetailBox||OpearLogDetailBox){
		PopupBox.closeCurrent();
	}
	var tpdId=$("#TPD_ID").val();
	if(!tpdId){
		showMessage("请选中一条记录！");
		return;
	}
	if (!ResolveddetailBox){
		ResolveddetailBox = new PopupBox('ResolveddetailBox','缺陷明细',{size:'big',height:'570px',top:'30px'});
	}
	var url = "index?TestProjectDefectResolvedDetail&TPD_ID="+tpdId+"&operaType=detail";
	ResolveddetailBox.sendRequest(url);
}

var OpearLogDetailBox;
function toOpearLogDetail(){
	if(ReleasedetailBox||ResolveddetailBox){
		PopupBox.closeCurrent();
	}
	var tpdId=$("#TPD_ID").val();
	if(!tpdId){
		showMessage("请选中一条记录！");
		return;
	}
	if (!OpearLogDetailBox){
		OpearLogDetailBox = new PopupBox('OpearLogDetailBox','操作日志',{size:'big',height:'570px',top:'30px'});
	}
	var url = "index?TestDefectOperateLogManageList&tpdId="+tpdId+"&operaType=detail";
	OpearLogDetailBox.sendRequest(url);
}


$(function(){	
	$("input[name^='pdState']").each(function(){ 
		var fontColor = {
				  "ACKNOWLEDGEMENT":"#7030A0",
				  "DISTRIBBTION":"#FFC000",
				  "EVALUATE":"#0070C0",
				  "INITIALIZE":"black",
				  "PROPOSE":"#FF0000",
				  "RECOGNITION":"#00B050",
				  "REJECTS":"black",
				  "RESOVE":"#00B0F0"
		};
		for(var i in fontColor){
	        if (fontColor.hasOwnProperty(i)) { 
	        	if($(this).val()==i){
	        		$(this).next().css("color",fontColor[i])
	        	}
	        };
	    }
		$(this).css("vertical-align","sub")
 	})
 	if(<%=pageBean.getBoolValue("testIsInit")%>||<%=pageBean.getBoolValue("projectIsNull")%>){
 		disableButton("addDEfectBtn");
 		$("#select-dev-people").hide();
 		$("#overall-box").attr("style","width:100%");  
 	}  
})

function refresh(){
	doSubmit({actionType:'prepareDisplay'});
}
var showPictureBox;
function showBugImg(resId){
	parent.window.showBugImg(resId)
}

function changeButtonState(tpdState){
	if(tpdState!='INITIALIZE'){
		disableButton("releaseImgBtn");
	} 
	if(tpdState =='INITIALIZE'){
		enableButton("releaseImgBtn");		
	}
	if(tpdState!='DISTRIBBTION'){
		disableButton("resolvedImgBtn");
	} 
	if(tpdState =='DISTRIBBTION'){
		enableButton("resolvedImgBtn");		
	}
	if(tpdState !='ACKNOWLEDGEMENT'){
		disableButton("approvalImgBtn");
		disableButton("notRecognImgBtn");	
	}
	if(tpdState =='ACKNOWLEDGEMENT'){
		enableButton("approvalImgBtn");
		enableButton("notRecognImgBtn");		
	}  	
	if(tpdState !='REJECTS'){
		disableButton("approvalImgBtn");
	}
	if(tpdState =='REJECTS'||tpdState =='ACKNOWLEDGEMENT'){
		enableButton("approvalImgBtn");
	}
	if(tpdState =='PROPOSE'){
		disableButton("editImgBtn");
	}
	if(tpdState =='INITIALIZE'){
		enableButton("editImgBtn");
	}
	if(tpdState =='REJECTS'){
		enableButton("notRecognImgBtn");
	}
}

function release(){
	if(!$("#TPD_ID").val()){
		showMessage("请选择一条记录")
		return;
	}
	
	postRequest('form1',{actionType:'release',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText=='success'){
			jAlert("已提交！","信息提示",function(){
				refresh();
			})
		}else{
			showMessage("提交失败！")
		} 
	}});	
}
function resolved(){
	if(!$("#TPD_ID").val()){
		showMessage("请选择一条记录")
		return;
	}
	postRequest('form1',{actionType:'resolved',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText=='success'){
			jAlert("已解决！","信息提示",function(){
				refresh();
			})
		}else{
			showMessage("变更失败！")
		} 
	}});	
}  

function approval(){
	if(!$("#TPD_ID").val()){
		showMessage("请选择一条记录")
		return;
	}
	postRequest('form1',{actionType:'approval',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText=='success'){
			jAlert("已认可！","信息提示",function(){
				refresh();
			})
		}else{
			showMessage("变更失败！")
		} 
	}});	
} 

function notRecognized(){
	if(!$("#TPD_ID").val()){
		showMessage("请选择一条记录")
		return;
	}
	postRequest('form1',{actionType:'notRecognized',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if (responseText=='success'){
			jAlert("已不认可！","信息提示",function(){
					refresh();
			})
		}else{
			showMessage("变更失败！")
		} 
	}});	
} 

var selectFunctionBox;
function openTreeFunction(){
	 
	 var handlerId = "TestSelectFunctionTree"; 
		if (!selectFunctionBox){
			selectFunctionBox = new PopupBox('selectFunctionBox','请选择功能',{size:'normal',width:'300',top:'2px'});
		}
		var url = 'index?'+handlerId+'&targetId=pfIds&targetName=pfNames';
		selectFunctionBox.sendRequest(url);
}
 
function clearPfids(){
	$("#pfNames").val("");
	$("#pfIds").val("");
}
$(function(){
	var flag=true;
	$('#btnCheckAllpdState').bind('click', function () {
		if(flag){
			$('[name = pdState]:checkbox').attr('checked', true);
			flag=false;
		}else{
			$('[name = pdState]:checkbox').attr('checked', false);
			flag=true;
		}
	});
	 $("body").show()
}) 
</script>
</form>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>